package com.xjtu.platform.security.register.Impl;

import com.xjtu.platform.security.register.FlagInsertService;
import com.xjtu.platform.security.register.MailDto;
import com.xjtu.platform.security.register.dao.FlagDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


@Service
@Transactional
public class FlagInsertServiceImpl implements FlagInsertService {

    @Resource
    private FlagDao flagDao;

    @Override
    public boolean insertFlag(MailDto mailDto,int code) {
        try {
            flagDao.insertFlag(mailDto,code);
            return true;
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }

    @Override
    public boolean getExist(MailDto mailDto) {
        try {
            int count = flagDao.getExist(mailDto);
            return count > 0;
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }
}
